import request from '@/utils/request'
import downloadFile from '@/utils/downloadFile'

// 优化
export function optimize(data) {
  return request({
    'url': '/optimization/optimize',
    headers: {
      isToken: true
    },
    'method': 'post',
    'data': data
  })
}

// 获取优化记录
export function listOptimizationRecordBycreateBy(data) {
  return request({
    url: '/optimization/record/listOptimizationRecordBycreateBy',
    headers: {
      isToken: true
    },
    method: 'get',
    data: data
  })
}
// 获取优化记录
export function getOptimizationById(id) {
  return request({
    url: '/optimization/record/'+id,
    headers: {
      isToken: true
    },
    method: 'get'
  })
}
// 删除优化记录
export function deleteOptimizationById(id) {
  return request({
    url: '/optimization/record/'+id,
    headers: {
      isToken: true
    },
    method: 'delete'
  })
}

// x下载数据
export function exportPfd(id) {
  return downloadFile({
    url: '/optimization/record/generatePdf/'+id,
    headers: {
      isToken: true
    }
  })
}
